package com.dodo.blog.ui.component.container;

import com.dodo.blog.ui.component.Component;
import com.dodo.blog.ui.component.HtmlComponent;

import java.util.ArrayList;
import java.util.List;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public class Container
        extends HtmlComponent
{
    private static final long serialVersionUID = 1L;

    private List<Component> comps = new ArrayList<Component>();

    private String innerHtml;

    public Container( Tag tag )
    {
        super( tag, Type.BLOCK );
    }

    public void prepend( Component component )
    {
        this.comps.add( 0, component );
    }

    public void add( Component component )
    {
        this.comps.add( component );
    }

    public List<Component> getComps()
    {
        return comps;
    }

    public void clear()
    {
        comps = new ArrayList<Component>();
    }

    public String getInnerHtml()
    {
        return innerHtml;
    }

    public void setInnerHtml( String innerHtml )
    {
        this.innerHtml = innerHtml;
    }
}
